﻿using FluentValidation;
using Grundy.Common;

namespace Grundy.Message.Licensing
{
    public class ReassertRequestValidator : AbstractValidator<ReassertRequest>
    {
        public ReassertRequestValidator()
        {
            this.CascadeMode = CascadeMode.Continue;
            RuleFor(r => r.Identifiers).NotEmpty().WithMessage("Identifiers are required for reassertion.");
            RuleFor(r => r.Identifiers).Must((r, i) => i.IsAdequateToIdentifyClient()).WithMessage("The identifiers sent by the client are not adequate to determine identity uniquely.");
            RuleFor(r => r.FeatureIdentificationKey).Must((r, i) => !i.IsEmpty()).WithMessage("The feature identification key must not be empty.");
        }
    }
}